﻿@model IEnumerable<GSLMS.Entity.TB_APP_SPECIALINFO>
@{
    Layout = null;
    ViewBag.ViewTitle = "特批申请";
    int i = 1;
    var SearchParma = ViewData["SearchParma"] as GSLMS.Entity.TB_APP_SPECIALINFO ?? new GSLMS.Entity.TB_APP_SPECIALINFO();
    SearchParma.CREATEDATE = DateTime.Now.AddMonths(-1);
    SearchParma.CREATEDATE_END = DateTime.Now;
    var ddlSpecialStatus = ViewData["SpecialStatus"] as SelectList;   
}
<form id="pagerForm" method="get" action="DianDang/Apply/SpecailInfo/index?action=page&OpID=@ViewData["OperateID"]">
<input type="hidden" name="pageNum" value="1" />
<input type="hidden" name="numPerPage" value="@ViewData["pageSize"]" />
<input type="hidden" name="RowCount" value="@ViewData["RowCount"]" />
<input type="hidden" name="CUSTNAME" value="@SearchParma.CUSTNAME" />
<input type="hidden" name="StarDateTime" value="@SearchParma.StarDateTime" />
<input type="hidden" name="EndDateTime" value="@SearchParma.EndDateTime" />
<input type="hidden" name="STATUS" value="@SearchParma.STATUS" />
</form>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this)" id="Form_@ViewData["CurrentController"]" action="DianDang/Apply/SpecailInfo/index?action=search&OpID=@ViewData["OperateID"]"
    method="post">
    <script>
        $(function () { 
        $('#Form_@ViewData["CurrentController"]').find("Status").val('@SearchParma.STATUS');
        });
    </script>
    <div class="searchBar">
        <table class="searchContent">
            <tr>
                <td>
                    客户名称：
                </td>
                <td>
                    @Html.TextBox("CUSTNAME", SearchParma.CUSTNAME, new {@style="width:100px;" })
                </td>
                <td>
                    申请日期：
                </td>
                <th>
                    @Html.TextBox("StarDateTime", SearchParma.StarDateTime, new { @class = "date", @style = "width:70px;", format = "yyyy-MM-dd", @maxDate = "%y-%M-%d", @readonly = "true", formatDate = "yyyy-MM-dd" })
                </th>
                <th>
                    ~
                    @Html.TextBox("EndDateTime", SearchParma.EndDateTime, new { @class = "date", @style = "width:70px;", format = "yyyy-MM-dd", @maxDate = "%y-%M-%d", @readonly = "true", formatDate = "yyyy-MM-dd" })
                </th>
                <td>
                    状态:
                </td>
                <td>
                   @* @foreach (var item in ddlSpecialStatus)
                    { 
                    <input type="checkbox" name="SpecialStatus" id="SpecialStatus" value="@item.Text" />@item.Text
                    }*@
                    @Html.DropDownList("Status", ddlSpecialStatus, GSLMS.WebAPP.HelperCommon.SelectDefaultValue, new { @class = "combox" })
                </td>
                <td align="right">
                    <div class="subBar">
                        <ul>
                            <li>
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <button type="submit" name="submit">
                                            检索</button></div>
                                </div>
                            </li>
                            <li>
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <button type="reset" name="reset">
                                            重置</button></div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    </form>
</div>
<div class="pageContent">
    @Html.Partial("Buttons")
    <table class="list" layouth="120" id="tableSpecailInfoList">
        <thead>
            <tr class="header">
                <th style="width:135px;">
                    客户名称
                </th>
                <th style="width:120px;">
                    项目经理
                </th>
                <th style="width:100px;">
                    申请日期
                </th>
                <th style="width:80px;">
                    审批状态
                </th>
                <th style="width:250px;">
                    详细内容
                </th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {            
            <tr target="SpecailInfo_id" rel="@item.ID" status="@item.STATUS">
                <td>
                    @item.CUSTNAME
                </td>
                <td style="text-align:center;">
                    @item.SALESMAN
                </td>
                <td style="text-align:center;">
                   @(item.CREATEDATE==null?"":(item.CREATEDATE.Value.ToString("yyyy-MM-dd")))
                </td>
                <td style="text-align:center;">
                    @((GSLMS.Entity.Enum.ApplyEnum.SpecialStatus)item.STATUS)
                </td>
                <td title="@item.DETAIL">
                    @item.DETAIL
                </td>
            </tr>
            i += 1;
        }
    </table>
</div>
@Html.Partial("PageBar")
<script type="text/javascript">
    function ToEdit(obj) {
        var $this = $(obj);
        var id = $("#tableSpecailInfoList").find(".selected").attr("rel");
        if (id) {
            var status = $("#tableSpecailInfoList").find(".selected").attr("status");
           
            if (status==0) {
               
                var rel = $this.attr("rel");
                var options = {};
                var title = $this.attr("title");
                var url = "DianDang/Apply/SpecailInfo/Create/" + id;
                $.pdialog.open(url, rel, title, options);
             
            }
            else {
                alertMsg.error("此特批申请已经提交不允许再编辑。");
            }
        }
        else {
            alertMsg.error("请选择一条记录");
        }
        return false;
    }
</script>

